package web.enumeditor;

import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;

import java.io.IOException;

public class SexTypeJsonSerializer extends JsonSerializer<Sex> {
    @Override
    public void serialize(Sex sex, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
        jsonGenerator.writeStartObject();
        jsonGenerator.writeFieldName("sex");
        jsonGenerator.writeString(sex.getChineseName());
        jsonGenerator.writeEndObject();
    }
}
